﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TKToXML
{
    public class RequestForStatus : BaseChungTu
    {
        public string MaDV { get; set; }       
        public int StatusDV { get; set; }        

        public string TenDV
        {
            get
            {
                using (var context = new ECUSTOMSEntities())
                {
                    var donVi = context.SDONVIs.Where(dv => dv.Ma == MaDV).First();

                    return donVi.Ten_U;
                }
            }
        }        

        public string ToXML()
        {
            string result = "<Declaration>";
            result += "<issuer>" + Type + "</issuer>";
            result += "<function>" + MessageFuntion.HoiTrangThai.ToString("d") + "</function>"; //hoi trang thai
            result += "<reference>" + Reference + "</reference>";
            result += "<Agent>";
                result += "<name>" + TenDV + "</name>";
                result += "<identity>" + MaDV + "</identity>";
                result += "<status>" + StatusDV.ToString() + "</status>";
            result += "</Agent>";

            result += "</Declaration>";

            return result;
        }
    }
}
